package libary;

public class AdultBook extends Book{
    public AdultBook() {
    }

    public AdultBook(String name) {
        super(name, 21);
    }

    @Override
    public double calFines(int borrowingDays) {
        int delay = borrowingDays-super.getBorrowingPeriod();
        double fines;
        if (delay<=0){ // 没有延期
            fines = 0;
        }else if (delay<=3){ // 延期3天以内 每天2元
            fines = delay*2;
        }else{ // 延期3天以内 每天2元 超出3天 每天5元
            fines = 3*2+(delay-3)*5;
        }
        return fines;
    }
}
